#include "FromContainsFilter.h"

#include <packet/Packet.h>



FromContainsFilter(std::string from) : 
	from(from)
{
	std::transform(from.begin(), from.end(), from.begin(), ::tolower);
}


bool accept(Packet * packet) {
	if (packet->getFrom().empty()) {
		return false;
	}
	else {
		std::string s = packet->getFrom();
		std::transform(s.begin(), s.end(), s.begin(), ::tolower);
		return s.find(from) == 0;
	}
}

